<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('出院结算列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>患者姓名：</label>
                            <input type="text" name="patientName"/>
                        </li>
                        <li>
                            <label>科室名称：</label>
                            <input type="text" name="departmentName"/>
                        </li>
                        <li>
                            <label>医生姓名：</label>
                            <input type="text" name="doctorName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>


        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('hospital:hospitalized:edit')}]];
    var removeFlag = [[${@permission.hasPermi('hospital:hospitalized:remove')}]];
    var settlementStatus = [[${@dict.getType('hospital_settlement_status')}]];

    var prefix = ctx + "hospital/discharge";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "住院登记",
            columns: [
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'patientName',
                    title: '患者姓名'
                },
                {
                    field: 'departmentName',
                    title: '科室名称'
                },
                {
                    field: 'doctorName',
                    title: '医生姓名'
                },
                {
                    field: 'admissionDate',
                    title: '入院日期'
                },
                {
                    field: 'bunk',
                    title: '床位'
                },
                {
                    field: 'createdTime',
                    title: '创建时间'
                },
                {
                    field: 'settlementStatus',
                    title: '结算状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(settlementStatus, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (row.settlementStatus != '1') {
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"  onclick="settlement(\'' + row.id + '\')"><i class="fa fa-edit"></i>结算</a> ');
                        }
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function settlement(id) {
        $.modal.open('结算', prefix + "/settlement?id=" + id);
    }

</script>
</body>
</html>